#pragma once

#include <vector>

/*
* the base class of the PointSet class
*
* author:	Yanbo Li
* date:		Jan. 12nd 2015
*/
class PointSet
{
protected:
	unsigned int dimension;
	double* coord_max;
	double* coord_min;

	virtual void validation_initialization();

public:
	static double Euclidean2(unsigned int N, double* p1, double* p2);

public:
	/*
	* coord_max	will be copied
	* coord_min	will be copied
	* division	will be copied
	*/
	PointSet(unsigned int dimension, double* coord_max, double* coord_min);
	
	virtual ~PointSet();

	bool inSpace(double* x);

	/*
	* the range query
	*/
	virtual void nearest_neighbor(double* key, double range, std::vector<double*>*& coords, std::vector<void*>*& results);

	/*
	* the k nearest neighbors
	*/
	virtual void nearest_neighbor(double* key, unsigned int k, std::vector<double*>*& coords, std::vector<void*>*& results);

	/*
	* the PointSet object does not hold ownership of input objects
	* the input objects will be referenced, but they will not be destoryed by the class
	*/
	virtual void add_point(double* key, void* object);
	virtual void del_point(double* key, void* object);

	/*
	* the number of elements in this point set
	*/
	virtual unsigned int size();
};

